<template>
  <div class="">
    用户名：<input type="text" v-model="username" /> 密码：<input
      type="text"
      v-model="password"
    />
    <button @click="login">登陆</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "",
      password: "",
    };
  },
  mounted() {},
  methods: {
    login() {
      if (this.username != "" && this.password != "") {
        this.$store.commit("setuser", this.username);
        this.$router.push("/my");
      }
    },
  },
  components: {},
};
</script>

<style lang="scss"></style>
